package com.bgq365.study.springboot2.boot02web.exception;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@Slf4j
@ControllerAdvice
public class GlobalExceptionResolver {

    @ExceptionHandler(value = {NullPointerException.class, ArrayIndexOutOfBoundsException.class, ArithmeticException.class})
    public String handlerGlobalException(Exception e) {
        log.error("异常是{}", e);
        return "login";
    }
}
